package com.example.back.controller;

import com.example.back.dto.req.DepartmentEditReq;
import com.example.back.dto.req.DepartmentListReq;
import com.example.back.dto.resp.DepartmentListResp;
import com.example.back.dto.resp.HospitalDepartmentResp;
import com.example.back.service.DepartmentService;
import com.example.common.entity.HospitalDepartment;
import com.example.common.support.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author wxy
 * @Date 2021/1/14 13:27
 * @Version 1.0
 */
@RestController
@Api(tags = "科室管理")
@RequestMapping("/api/Department")
public class DepartmentController {
    @Resource
    private DepartmentService departmentService;

    @ApiOperation(value = "科室列表", notes = "科室列表")
    @PostMapping(value = "/List")
    public Result<List<HospitalDepartmentResp>> List(@RequestBody DepartmentListReq req) {
        return Result.success(departmentService.List(req));
    }

    @ApiOperation(value = "启用、禁用", notes = "启用、禁用")
    @PostMapping(value = "/DoDisable")
    public Result<Object> DoDisable(@RequestBody DepartmentEditReq req) {
        return Result.success(departmentService.DoDisable(req));
    }

    @ApiOperation(value = "详情", notes = "详情")
    @PostMapping(value = "/Info")
    public Result<Object> Info(@RequestBody DepartmentEditReq req) {
        return Result.success(departmentService.Info(req));
    }

    @ApiOperation(value = "保存", notes = "保存")
    @PostMapping(value = "/Save")
    public Result<Object> Save(@RequestBody DepartmentEditReq req) {
        return Result.success(departmentService.Save(req));
    }
}
